<script setup lang="ts" name="menuTree">
import menuItemTree from '@/components/menuItemTree.vue'
import { useUserStore } from '@/store/user'
import { useRoute, useRouter } from 'vue-router'
const userStore = useUserStore()
const router = useRouter()
const route = useRoute()
const menuList:any = userStore.menuTree

// // 递归树形路由获取跳转目标路由
// const getPath = (data:any)=>{
//     if(data.children.length == 0){
//         return data.path
//     }
//     return getPath(data.children[0])
// }

// // 判断是否跳/（第一次登录成功跳转，根据权限菜单跳转到第一个路由）
// if(route.path == '/'){
//     let targetPath = getPath(menuList[0])
//     router.push(targetPath)
// }

</script>

<template>
    <el-menu :default-active="$route.path" router>
        <menuItemTree :menuList="menuList" />
    </el-menu>
</template>

<style scoped lang="scss">
.el-menu {
    border: none;
}
</style>